// 子模块moduleA路径：store/modules/moduleA.js 
export default {
	namespaced: true,
	state: {
		carList: uni.getStorageSync('carList') || []
	},
	getters: {
		
	},
	mutations: {
		addCarList(state, payload) {
			const item = state.carList.find(v => v.id === payload.id);
			if(item) item.count++;
			else state.carList.push(payload);
		},
		subCarList(state, payload) {
			const item = state.carList.find(v => v.id === payload.id);
			if(item) item.count--;
		},
		deleteCarList(state, payload) {
			state.carList = state.carList.filter(v => v.id !== payload.id)
		}
	},
	actions: { 
		
	}
}
